<header class="navbar">
    <% if !mobile_device? && current_page?(root_path) %>
    <div id="site_title"><%= link_to "La compète", root_path %>
    </div>
    <% end %>
    <nav>
      <ul class="main-menu"><!-- Menu principal normal -->
        <div>
          <li><%= link_to content_tag(:i, nil, class: 'fas fa-home'), root_path %></li>
          <li id="site_title_fixed"><%= link_to "La compète", root_path %></li>
          <li class="principal_item"><%= link_to "Liste des Compétitions", all_tournaments_path %>
            <% if Tournament.count > 1 %>
                <ul class="sous_menu">
                <% Tournament.order('id DESC').first(3).each { |t| %>
                  <li><%= link_to t.name, tournament_path(t) %></li>
                <% } %>
                </ul>
            <% end %>
          </li>
          <li><%= link_to "Liste des Matchs", all_matches_path %> </li>
        </div>
        <div>
        <li class="divider"></li>
        <li><%= link_to "Nouveau match", new_match_path %> </li>
        <li><%= link_to "Créateur de match", alea_match_path %> </li>
        <% if user_signed_in? %>
          <li class="dropdown">Paramètres

            <ul class="dropdown-menu">
              <li><%= link_to "Nouveau joueur", new_player_path %> </li>
              <li><%= link_to "Nouveau club", new_club_path %> </li>
              <li><%= link_to "Liste des clubs", all_clubs_path %> </li>
              <li><%= link_to "Modifier mon compte", edit_user_registration_path %>
              </li>
              <% if current_user.admin %>
                <li><%= link_to "Administration", admin_path %></li>
                <li><%= link_to "Saisons", all_seasons_path %></li>

              <% end %>

              <li><%= link_to "Se déconnecter", destroy_user_session_path, method: :delete  %>
              </li>
            </ul>
          </li>
        </div>
        <% else%>
            <li><%= link_to content_tag(:i, nil, class: 'far fa-user'), new_user_session_path %>
            </li>
        <% end %>


      </ul>
      <% if mobile_device? %>

        <div id="site_title_mobile"><%= link_to "La compète", root_path %>
        <div class="menu-symbol">
          <i class="fas fa-bars"></i>
        </div>
        <ul class="mobile-menu" style="display:none;"><!-- Menu mobile -->
          <li><%= link_to "Accueil", '/' %></li>
          <li><%= link_to "Liste des Compétitions", all_tournaments_path %></li>
          <li><%= link_to "Liste des Matchs", all_matches_path %> </li>
          <li class="divider"></li>
          <li><%= link_to "Nouveau match", new_match_path %> </li>
          <li><%= link_to "Créateur de match", alea_match_path %> </li>
          <% if user_signed_in? %>
            <li class="dropdown">Paramètres
                <li><%= link_to "Nouveau joueur", new_player_path %> </li>
                <li><%= link_to "Nouveau club", new_club_path %> </li>
                <li><%= link_to "Liste des clubs", all_clubs_path %> </li>
                <li><%= link_to "Modifier mon compte", edit_user_registration_path %>
                </li>
                <li><%= link_to "Administration", admin_path %></li>

                <li><%= link_to "Se déconnecter", destroy_user_session_path, method: :delete  %>
                </li>
            </li>

          <% else%>
              <li><%= link_to "Se connecter", new_user_session_path %>
              </li>
          <% end %>
        </ul> <!-- FIN Menu mobile -->
      <% end %>

    </nav>
</header>
